# Python __del__()方法：销毁对象
class CLanguage:
    def __init__(self):
        print("调用 __init__() 方法构造对象")
    
    def __del__(self):
        print("调用 __del__() 销毁对象，释放其空间")

clangs = CLanguage()
del clangs
print()

clangs = CLanguage()
# 添加一个引用clangs对象的实例对象
cl = clangs
del clangs
print("****************")
del cl
print("----------------")
print()

class CLanguage:
    def __del__(self):
        print("调用父类 __del__() 方法")

class CL(CLanguage):
    def __del__(self):
        print("调用子类 __del__() 方法")

c = CL()
del c
